import type { TableColumn } from '@/components/core/dynamic-table';
// import { Avatar, Space, Tag } from 'ant-design-vue';

export type TableListItem = API.AttributeListResultItem;
export type TableColumnItem = TableColumn<TableListItem>;

export const baseColumns: TableColumnItem[] = [
  {
    title: '序号',
    dataIndex: 'id',
    align: 'center',
    hideInSearch: true,
    editable: false,
  },

  // {
  //   title: '属性类型',
  //   align: 'center',
  //   dataIndex: 'attributeType',
  // },
  {
    title: '属性名称',
    align: 'center',
    dataIndex: 'name',

    editable: true,
    formItemProps: {
      defaultValue: '',
      rules: [{ required: true, message: '请输入属性名称' }],
    },
    editFormItemProps: {
      /** 不继承于 `formItemProps`的属性 */
      extendSearchFormProps: false,
      rules: [{ required: true, message: '请输入属性名称' }],
    },
  },
  {
    title: '数值类型',
    align: 'center',
    dataIndex: 'numericType',
    editable: true,
    /** 搜索表单配置 */
    formItemProps: {
      component: 'Select',
      componentProps: ({ formModel }) => ({
        options: [
          {
            label: '整数',
            value: '01',
          },
          {
            label: '浮点数',
            value: '02',
          },
          {
            label: '字符串',
            value: '03',
          },
          {
            label: '布尔',
            value: '04',
          },
        ],
        onChange() {
          console.log('formModel', formModel);

          // 根据当前选择的性别，更新衣服可选项
          // formInstance?.updateSchema({
          //   field: `clothes`,
          //   componentProps: {
          //     options: getClothesByGender(formModel.gender),
          //   },
          //});
          // formModel['clothes'] = undefined;
        },
      }),
    },
  },
  {
    title: '最大值',
    align: 'center',
    dataIndex: 'maximum',
    editable: true,
    formItemProps: {
      component: 'InputNumber',
      defaultValue: '',
      rules: [{ required: true, message: '请输入最大值' }],
    },
    editFormItemProps: {
      /** 不继承于 `formItemProps`的属性 */
      extendSearchFormProps: false,
      // rules: [{ required: true, message: '请输入属性名称' }],
    },
  },
  {
    title: '精度',
    align: 'center',
    dataIndex: 'precision',
  },
  {
    title: '单位',
    align: 'center',
    dataIndex: 'unit',
  },
  {
    title: '备注',
    align: 'center',
    dataIndex: 'remark',
  },
];
